# _*_ coding:utf-8 _*_
# @Time  : 2023.08.31
# @Author: zizlee
from PyPDF2 import PdfReader, PdfWriter

reader = PdfReader('瑞达期货沪铝周报.pdf')

number_of_pages = len(reader.pages)
#1.28.0版本之前用numPages，已经过时，见：https://pypdf2.readthedocs.io/en/latest/modules/PdfReader.html#PyPDF2.PdfReader.numPages

print(number_of_pages)  #打印页数
page = reader.pages[0]
#1.28.0版本之前用getPage(pageNumber)，已经过时，见：https://pypdf2.readthedocs.io/en/latest/modules/PdfReader.html#PyPDF2.PdfReader.getPage
# print(page)  #打印“PDF第一页”这个Page<PyPDF2._page.Page>对象
fonts = page['/Resources']['/Font']
for f in page['/Resources']['/Font']:
    print(f, fonts[f])

